package leetcode_701_800;

public class LeeCode_724 {
    public static void main(String[] args) {

    }
    private static int pivotIndex(int[] nums) {
        int n = nums.length;
        int[] sums = new int[n + 1];
        for (int i = 1; i <= n; i++) {
            sums[i] = sums[i - 1] + nums[i - 1];
        }
        for (int i = 1; i <= n; i++) {
            if (sums[i - 1] == sums[n] - sums[i]){
                return i - 1;
            }
        }
        return -1;
    }
}
